import Taro, { useEffect } from '@tarojs/taro';
import { Swiper, SwiperItem, View, Image } from '@tarojs/components';
import PropTypes from 'prop-types';

const CustomSwiper = props => {
  useEffect(() => {
    console.log(props.list);
  }, [props.list]);
  return (
    <Swiper indicatorColor="#999" indicatorActiveColor="#333" circular indicatorDots autoplay>
      {props.list.map((item, index) => {
        return (
          <SwiperItem key="item">
            <Image style={{ width: '100%', height: 150 }} mode="widthFix" src={item} />
          </SwiperItem>
        );
      })}
    </Swiper>
  );
};

CustomSwiper.defaultProps = {
  list: [],
};

CustomSwiper.PropTypes = {
  list: PropTypes.arrayOf(PropTypes.string),
};

export default CustomSwiper;
